const controller = require('./controller/index.js');

/**
 * 云函数统一入口
 */
exports.main = async (event, context) => {
  const { data, action } = event;
  // 通过路由寻找controller
  var method = controller[action];
  var request = data;

  if (!method) {
    return 404;
  }
  return method(request);
}